/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.buanalintas.sandals.pos.entities;

import com.buanalintas.bynga.entities.MasterUnit;
import com.buanalintas.bynga.entities.MasterUser;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Developer
 */
@Entity
@Table(name = "pos_master_sales")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "PosMasterSales.findAll", query = "SELECT p FROM PosMasterSales p"),
    @NamedQuery(name = "PosMasterSales.findBySync", query = "SELECT p FROM PosMasterSales p WHERE p.sync = :sync"),
    @NamedQuery(name = "PosMasterSales.findBySalesId", query = "SELECT p FROM PosMasterSales p WHERE p.salesId = :salesId"),
    @NamedQuery(name = "PosMasterSales.findBySalesName", query = "SELECT p FROM PosMasterSales p WHERE p.salesName = :salesName"),
    @NamedQuery(name = "PosMasterSales.findBySalesPlaceOfBirth", query = "SELECT p FROM PosMasterSales p WHERE p.salesPlaceOfBirth = :salesPlaceOfBirth"),
    @NamedQuery(name = "PosMasterSales.findBySalesDateOfBirth", query = "SELECT p FROM PosMasterSales p WHERE p.salesDateOfBirth = :salesDateOfBirth"),
    @NamedQuery(name = "PosMasterSales.findBySalesAddress", query = "SELECT p FROM PosMasterSales p WHERE p.salesAddress = :salesAddress"),
    @NamedQuery(name = "PosMasterSales.findBySalesPhone", query = "SELECT p FROM PosMasterSales p WHERE p.salesPhone = :salesPhone"),
    @NamedQuery(name = "PosMasterSales.findBySalesEmail", query = "SELECT p FROM PosMasterSales p WHERE p.salesEmail = :salesEmail")})
public class PosMasterSales implements Serializable {

    private static final long serialVersionUID = 1L;
    @Column(name = "sync")
    private String sync;
    @Id
    @Basic(optional = false)
    @Column(name = "sales_id")
    private Integer salesId;
    @Column(name = "sales_name")
    private String salesName;
    @Column(name = "sales_place_of_birth")
    private String salesPlaceOfBirth;
    @Column(name = "sales_date_of_birth")
    @Temporal(TemporalType.DATE)
    private Date salesDateOfBirth;
    @Column(name = "sales_address")
    private String salesAddress;
    @Column(name = "sales_phone")
    private String salesPhone;
    @Column(name = "sales_email")
    private String salesEmail;
    @JoinColumn(name = "sales_unit_id", referencedColumnName = "unit_id")
    @ManyToOne(optional = false)
    private MasterUnit salesUnitId;
    @JoinColumn(name = "sales_user_id", referencedColumnName = "user_id")
    @ManyToOne(optional = false)
    private MasterUser salesUserId;

    public PosMasterSales() {
    }

    public PosMasterSales(Integer salesId) {
        this.salesId = salesId;
    }

    public String getSync() {
        return sync;
    }

    public void setSync(String sync) {
        this.sync = sync;
    }

    public Integer getSalesId() {
        return salesId;
    }

    public void setSalesId(Integer salesId) {
        this.salesId = salesId;
    }

    public MasterUnit getSalesUnitId() {
        return salesUnitId;
    }

    public void setSalesUnitId(MasterUnit salesUnitId) {
        this.salesUnitId = salesUnitId;
    }

    public MasterUser getSalesUserId() {
        return salesUserId;
    }

    public void setSalesUserId(MasterUser salesUserId) {
        this.salesUserId = salesUserId;
    }

    public String getSalesName() {
        return salesName;
    }

    public void setSalesName(String salesName) {
        this.salesName = salesName;
    }

    public String getSalesPlaceOfBirth() {
        return salesPlaceOfBirth;
    }

    public void setSalesPlaceOfBirth(String salesPlaceOfBirth) {
        this.salesPlaceOfBirth = salesPlaceOfBirth;
    }

    public Date getSalesDateOfBirth() {
        return salesDateOfBirth;
    }

    public void setSalesDateOfBirth(Date salesDateOfBirth) {
        this.salesDateOfBirth = salesDateOfBirth;
    }

    public String getSalesAddress() {
        return salesAddress;
    }

    public void setSalesAddress(String salesAddress) {
        this.salesAddress = salesAddress;
    }

    public String getSalesPhone() {
        return salesPhone;
    }

    public void setSalesPhone(String salesPhone) {
        this.salesPhone = salesPhone;
    }

    public String getSalesEmail() {
        return salesEmail;
    }

    public void setSalesEmail(String salesEmail) {
        this.salesEmail = salesEmail;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (salesId != null ? salesId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PosMasterSales)) {
            return false;
        }
        PosMasterSales other = (PosMasterSales) object;
        if ((this.salesId == null && other.salesId != null) || (this.salesId != null && !this.salesId.equals(other.salesId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return salesName;
    }
}
